<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
<div id="app">
  <input type="text" v-model="message.a">
  <ul>
    <li>{{message.a}}</li>
  </ul>
  <br>
  <input type="text" v-model="name"> <br>
  我的名字是：{{ name }}<br>
  {{number}}元
  <button v-click="increment">增加</button>
</div>

<script src="mvvm.js"></script>
<script src="compile.js"></script>
<script src="observer.js"></script>
<script src="watcher.js"></script>
<script>
// 1. 解析片段，碎片化文档-- documentFragment
// 2. 观察-订阅者模式，进行数据绑定--数据劫持
// 3. 动态数据，发布通知
let vm = new MVVM({
  el: '#app',
  data: {
    message: {
      a: 'hello world'
    },
    name: 'Hi, River',
    number: 100
  },
  methods: {
    increment() {
      console.log(this.name)
      this.number++
    }
  }
})

// setTimeout(() => {
//   vm.$data.name = 'Hi, WeiRiver'
// }, 1000)
</script>
</body>
</html>
